Previous Book Contents Book Index Next

Inside Macintosh: Open Transport /
Chapter 8 - TCP/IP Services / TCP/IP Services Reference
Constants and Data Types


Basic Types and Constants

The data types defined in this section are used by other structures and functions of the Open Transport API. They are not specific to TCP/IP, but are included here for your convenience.

typedef unsigned char UInt8;
typedef unsigned short UInt16;
typedef unsigned long UInt32;
typedef char SInt8;
typedef short SInt16;
typedef long SInt32;
typedef UInt16 InetPort;
typedef UInt32 InetHost;
You can use the protocol names kTCPName, kUDPName, and kRawIPName when calling the OTCreateConfiguration function to configure an endpoint. You can use the protocol name kDNRName when calling the OTCreateConfiguration function to configure a mapper. The OTCreateConfiguration function is described in the chapter "Configuration Management" in this book.

#define kDNRName        'dnr'
#define kTCPName        'tcp'
#define kUDPName        'udp'
#define kRawIPName      'rawip'
You can use the constant kDefaultInternetServicesPath to create a TCP/IP service provider. Its value is a pointer to a configuration structure, so you do not use the OTCreateConfiguration function with this constant. Instead you use this constant as a parameter when calling the OTAsyncOpenInternetServices and the OTOpenInternetServices functions that create TCP/IP service providers.

#define kDefaultInternetServicesPath((OTConfiguration*)-3)
You use the AF_INET and AF_DNS values as address types when filling in address structures (see "Internet Address Structure" on page 8-22 and "DNS Address Structure" on page 8-23). You can use the kOTAnyInetAddress value with the OTBind function (page 8-15).

enum {
      AF_INET        = 2,,    /* TCP/IP address */
      AF_DNS         = 42     /* domain name server address */
};
You can use the kOTAnyInetAddress value with the OTBind function (page 8-15).

enum {
      kOTAnyInetAddress = 0   /* wildcard */
};
enum { 
      kMaxHostAddrs     = 10,
      kMaxSysStringLen  = 32,
      kMaxHostNameLen   = 255
};
typedef char InetDomainName[kMaxHostNameLen];
Note
The maximum valid domain-name length for fully qualified domain names includes the trailing period (.). Names not terminated with a period are limited to
254 bytes.
The following completion event codes are returned by TCP/IP service
provider functions:

enum {
      T_DNRSTRINGTOADDRCOMPLETE  = kPRIVATEEVENT+1,
      T_DNRADDRTONAMECOMPLETE    = kPRIVATEEVENT+2,
      T_DNRSYSINFOCOMPLETE       = kPRIVATEEVENT+3,
      T_DNRMAILEXCHANGECOMPLETE  = kPRIVATEEVENT+4,
      T_DNRQUERYCOMPLETE         = kPRIVATEEVENT+5
};
enum {
      kDefaultInetInterface      = -1,
      kInetInterfaceInfoVersion  = 2
};
enum {
      kPRIVATEEVENT= (OTEventCode)0x10000000
};
The following are miscellaneous TCP/IP-related constants. Some, such as the version number, are subject to change.

#define kInetVersion "3.0" /* MacTCP 3.0*/
#define kInetPrefix "ot:inet$" 
#define SET_TOS(prec,tos)(((0x7 & (prec)) << 5) | (0x1c & (tos)))

Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 AUG 1996